class Solution:
    def majorityElement(self, nums) -> int:
        dic = {}
        for i in nums:
            if i in dic:
                dic[i] = dic[i] + 1
            else:
                dic[i] = 1
            if dic[i] > len(nums) // 2:
                return i


if __name__ == '__main__':
    so = Solution()
    s = [2]
    r = so.majorityElement(s)
    print(r)
